package com.kevin.bean;

import java.util.HashMap;
import java.util.Map;

public class Project {
	
	final static String file_separator=System.getProperty("file.separator");
	final static String line_separator=System.getProperty("line.separator");
	
	public String workspace;
	
	public String projectType;
	
	public boolean isNewProject;
	
	public boolean hasProvider;

	public String messageXsdVersion;
	
	public String serviceName;
	
	public String operationName;
	
	public String abstractWSDLPath;
	
	public String xsdPath;
	
	public String providerWSDLPath;
	
	public String serviceAgentPath;
	

	public String getWorkspace() {
		return workspace;
	}

	public void setWorkspace(String workspace) {
		this.workspace = workspace;
	}

	public String getProjectType() {
		return projectType;
	}

	public void setProjectType(String projectType) {
		this.projectType = projectType;
	}

	public boolean isNewProject() {
		return isNewProject;
	}

	public void setNewProject(boolean isNewProject) {
		this.isNewProject = isNewProject;
	}

	public boolean isHasProvider() {
		return hasProvider;
	}

	public void setHasProvider(boolean hasProvider) {
		this.hasProvider = hasProvider;
	}

	public String getMessageXsdVersion() {
		return messageXsdVersion;
	}

	public void setMessageXsdVersion(String messageXsdVersion) {
		this.messageXsdVersion = messageXsdVersion;
	}

	public String getServiceName() {
		return serviceName;
	}

	public void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}

	public String getOperationName() {
		return operationName;
	}

	public void setOperationName(String operationName) {
		this.operationName = operationName;
	}

	public String getAbstractWSDLPath() {
		return this.workspace+"CoreServicesResources"+file_separator+"BusinessServices"+file_separator+this.serviceName+file_separator+this.serviceName+this.messageXsdVersion+"_abstract.wsdl";
	}

	public String getXsdPath() {
		return this.workspace+"CoreServicesResources"+file_separator+"BusinessServices"+file_separator+this.serviceName+file_separator+this.serviceName+this.messageXsdVersion+".xsd";
	}

	public String getProviderWSDLPath() {
		return this.workspace+"CoreServicesResources"+file_separator+"Providers"+file_separator+this.serviceName+".wsdl";
	}

	public String getServiceAgentPath() {
		return this.workspace+"CoreServices"+file_separator+"BusinessServices"+file_separator+this.serviceName+file_separator+"v"+this.messageXsdVersion+file_separator+this.serviceName+".serviceagent";
	}

	public Map<String,String> getConFilter(){
		Map<String,String> map=new HashMap<String,String>();
		map.put("${MessageXsdVersion}", messageXsdVersion);
		map.put("${ServiceName}", serviceName);
		map.put("${OperationName}", operationName);
		return map;
	}
	
	public String getTargetDir() {
		return this.workspace;
	}
	

	@Override
	public String toString() {
		return "Project ["+line_separator+" getWorkspace()=" + getWorkspace()
				+ ", "+line_separator+" getProjectType()=" + getProjectType()
				+ ", "+line_separator+" isNewProject()=" + isNewProject() + ", "+line_separator+" isHasProvider()="
				+ isHasProvider() + ", "+line_separator+" getMessageXsdVersion()="
				+ getMessageXsdVersion() + ", "+line_separator+" getServiceName()="
				+ getServiceName() + ", "+line_separator+" getOperationName()="
				+ getOperationName() + ", "+line_separator+" getAbstractWSDLPath()="
				+ getAbstractWSDLPath() + ", "+line_separator+" getXsdPath()=" + getXsdPath()
				+ ","+line_separator+" getProviderWSDLPath()=" + getProviderWSDLPath()
				+ ","+line_separator+" getServiceAgentPath()=" + getServiceAgentPath()
				+ ","+line_separator+" getConFilter()=" + getConFilter() + ","+line_separator+" getTargetDir()="
				+ getTargetDir() + "]";
	}

	public static Project mock(){
		Project project=new Project();
		project.workspace="F:"+file_separator+"xyzq"+file_separator+"bwproject"+file_separator+"ESBPrj1.0.0"+file_separator;
		project.projectType="req-res"; 
		project.isNewProject=true;
		project.hasProvider=false;
		project.messageXsdVersion="1.0.0";
		project.serviceName="MOTPublishService"; 
		project.operationName="PublishInfo"; 
		project.abstractWSDLPath="F:"+file_separator+"xyzq"+file_separator+"bwproject"+file_separator+"ESBPrj1.0.0"+file_separator+"CoreServicesResources"+file_separator+"BusinessServices"+file_separator+"MOTPublishService"+file_separator+"MOTPublishService1.0.0_abstract.wsdl"; 
		project.xsdPath="F:"+file_separator+"xyzq"+file_separator+"bwproject"+file_separator+"ESBPrj1.0.0"+file_separator+"CoreServicesResources"+file_separator+"BusinessServices"+file_separator+"MOTPublishService"+file_separator+"MOTPublishService1.0.0.xsd";
		project.providerWSDLPath="F:"+file_separator+"xyzq"+file_separator+"bwproject"+file_separator+"ESBPrj1.0.0"+file_separator+"CoreServicesResources"+file_separator+"Providers"+file_separator+"MOTPublishService.wsdl"; 
		project.serviceAgentPath="F:"+file_separator+"xyzq"+file_separator+"bwproject"+file_separator+"ESBPrj1.0.0"+file_separator+"CoreServices"+file_separator+"BusinessServices"+file_separator+"MOTPublishService"+file_separator+"v1.0.0"+file_separator+"MOTPublishService.serviceagent";
		return project;
	}


	public static Project mock2(){
		Project project=new Project();
		project.workspace="F:"+file_separator+"xyzq"+file_separator+"bwproject"+file_separator+"ESBPrj1.0.0"+file_separator;
		project.projectType="pub-sub"; 
		project.isNewProject=true;
		project.hasProvider=false;
		project.messageXsdVersion="1.0.0";
		project.serviceName="MOTPublishService"; 
		project.operationName="PublishInfo"; 
		return project;
	}
	
	public static Project mock_osx_pub_sub_new_project(){
		Project project=new Project();
		project.workspace="/Users/kevin/workspace/";
		project.projectType="pub-sub"; 
		project.isNewProject=true;
		project.hasProvider=false;
		project.messageXsdVersion="1.1.0";
		project.serviceName="MOTPublishService"; 
		project.operationName="PublishInfo"; 
		return project;
	}
	
	public static Project mock_osx_pub_sub_append_project(){
		Project project=new Project();
		project.workspace="/Users/kevin/workspace/";
		project.projectType="pub-sub"; 
		project.isNewProject=false;
		project.hasProvider=false;
		project.messageXsdVersion="1.1.0";
		project.serviceName="MOTPublishService"; 
		project.operationName="PublishData"; 
		return project;
	}
	
	public static Project mock_osx_req_res_new_project(){
		Project project=new Project();
		project.workspace="/Users/kevin/workspace/";
		project.projectType="req-res"; 
		project.isNewProject=true;
		project.hasProvider=true;
		project.messageXsdVersion="1.1.0";
		project.serviceName="SMSService"; 
		project.operationName="SendMessage"; 
		return project;
	}
	
	public static Project mock_osx_req_res_append_project(){
		Project project=new Project();
		project.workspace="/Users/kevin/workspace/";
		project.projectType="req-res"; 
		project.isNewProject=false;
		project.hasProvider=true;
		project.messageXsdVersion="1.1.0";
		project.serviceName="SMSService"; 
		project.operationName="QueryMessage"; 
		return project;
	}
	
	public static void main(String[] args) {
		Project p=new Project();
//		System.out.println(p.mock());
		System.out.println(p.mock2());
		
	}
	
	
	

}
